import { getStartEndTime } from '@/utils/date.js'

export const useTimeTypeSelect = () => {
  const timeList = ref([])
  function initTimeList() {
    timeList.value = [
      {
        label: '不限',
        ...getStartEndTime(0, 0),
        value: '不限'
      },
      {
        label: '今天',
        ...getStartEndTime(0, 0),
        value: '今天'
      },
      {
        label: '昨天',
        ...getStartEndTime(-1, -1),
        value: '昨天'
      },
      {
        label: '近一周',
        ...getStartEndTime(-6, 0),
        value: '近一周'
      },
      {
        label: '近一月',
        ...getStartEndTime(-30, 0),
        value: '近一月'
      },
      {
        label: '近一年',
        ...getStartEndTime(-365, 0),
        value: '近一年'
      }
    ]
  }
  return { timeList, initTimeList }
}
